'\" e
'\"! eqn | mmdoc
'\"macro stdmacro
.ds Vn Version 1.2
.ds Dt 24 September 1999
.ds Re Release 1.2.1
.ds Dp Jan 14 18:30
.ds Dm 01 getmateri
.ds Xs 34280 6 getmaterial.gl
.TH GLGETMATERIAL 3G
.SH NAME
.B "glGetMaterialfv, glGetMaterialiv
\- return material parameters

.SH C SPECIFICATION
void \f3glGetMaterialfv\fP(
GLenum \fIface\fP,
.nf
.ta \w'\f3void \fPglGetMaterialfv( 'u
	GLenum \fIpname\fP,
	GLfloat \fI*params\fP )
.fi
void \f3glGetMaterialiv\fP(
GLenum \fIface\fP,
.nf
.ta \w'\f3void \fPglGetMaterialiv( 'u
	GLenum \fIpname\fP,
	GLint \fI*params\fP )
.fi

.EQ
delim $$
.EN
.SH PARAMETERS
.TP \w'\fIparams\fP\ \ 'u 
\f2face\fP
Specifies which of the two materials is being queried.
\%\f3GL_FRONT\fP or \%\f3GL_BACK\fP are accepted,
representing the front and back materials, respectively.
.TP
\f2pname\fP
Specifies the material parameter to return.
\%\f3GL_AMBIENT\fP,
\%\f3GL_DIFFUSE\fP,
\%\f3GL_SPECULAR\fP,
\%\f3GL_EMISSION\fP, 
\%\f3GL_SHININESS\fP, and
\%\f3GL_COLOR_INDEXES\fP
are accepted.
.TP
\f2params\fP
Returns the requested data.
.SH DESCRIPTION
\%\f3glGetMaterial\fP returns in \f2params\fP the value or values of parameter \f2pname\fP
of material \f2face\fP. Six parameters are defined:
.TP 22
\%\f3GL_AMBIENT\fP
\f2params\fP returns four integer or floating-point values representing the
ambient reflectance of the material.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value is
(0.2, 0.2, 0.2, 1.0)
.TP
\%\f3GL_DIFFUSE\fP
\f2params\fP returns four integer or floating-point values representing the
diffuse reflectance of the material.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value is
(0.8, 0.8, 0.8, 1.0).
.TP
\%\f3GL_SPECULAR\fP
\f2params\fP returns four integer or floating-point values representing the
specular reflectance of the material.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1],
the corresponding integer return value is undefined. The initial value is
(0, 0, 0, 1).
.TP
\%\f3GL_EMISSION\fP
\f2params\fP returns four integer or floating-point values representing the
emitted light intensity of the material.
Integer values,
when requested,
are linearly mapped from the internal floating-point representation
such that 1.0 maps to the most positive representable integer value,
and \-1.0 maps to the most negative representable integer value.
If the internal value is outside the range [\-1, 1.0],
the corresponding integer return value is undefined. The initial value is
(0, 0, 0, 1). 
.TP
\%\f3GL_SHININESS\fP
\f2params\fP returns one integer or floating-point value representing the
specular exponent of the material.
Integer values,
when requested,
are computed by rounding the internal floating-point value to the
nearest integer value. The initial value is 0. 
.TP
\%\f3GL_COLOR_INDEXES\fP
\f2params\fP returns three integer or floating-point values representing the
ambient, diffuse, and specular indices of the material.
These indices are used only for color index lighting.
(All the other parameters are used only for RGBA lighting.)
Integer values,
when requested,
are computed by rounding the internal floating-point values to the
nearest integer values.
.SH NOTES
If an error is generated,
no change is made to the contents of \f2params\fP.
.SH ERRORS
\%\f3GL_INVALID_ENUM\fP is generated if \f2face\fP or \f2pname\fP is not an
accepted value.
.P
\%\f3GL_INVALID_OPERATION\fP is generated if \%\f3glGetMaterial\fP
is executed between the execution of \%\f3glBegin\fP
and the corresponding execution of \%\f3glEnd\fP.
.SH SEE ALSO
\%\f3glMaterial(3G)\fP
